package com.example.demo.threadDemo.aCreateThread;

/**
 * @Description MyThresd2
 * @Author songchuanlong
 * @Date 2025-04-14
 */


/**
 * 定义一个任务类实现Runnable接口
 */
public class MyThresd2 implements Runnable{
    /**
     * When an object implementing interface {@code Runnable} is used
     * to create a thread, starting the thread causes the object's
     * {@code run} method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method {@code run} is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        for (int i = 1; i <= 5; i++) {
            System.out.println("MyThresd2线程输出："+i);
        }
    }
}
